<?php
use PsiFramework\Classes\Util\HTTP\Request;

header('content-type: application/json; charset=utf-8');

$objects = $response->getAttribute("objects");
$json = json_encode($objects);

$jsonpCallback = Request::getInstance()->getParameter('jsonpcallback');

if (!isNullOrEmptyString($jsonpCallback)) {
    $json = $jsonpCallback.'('.$json.');';
}

echo $json;
exit;